<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>菜单栏-渲染li元素</title>
    <style>
        li{
            list-style: none;
            float: left;
            margin-left: 30px;
        }
    </style>
</head>
<body>
    <input type="button" value="显示菜单栏" onclick="showLi()"/>
    <ul class="nav"></ul>
</body>
<script>

    function showLi(){
        let arr = ["天猫小店","天猫国际","天猫闪购","天猫超市","淘淘生鲜","淘淘全球购"]

        let nav = document.querySelector(".nav");
        let s = "";
        for(let i in arr){
            s+="<li>"+arr[i]+"</li>"
        }
        console.log(s)
        nav.innerHTML = s
    }

</script>
</html>